/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package database;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;
import model.Dokument;
import model.Dosen;

/**
 *
 * @author Adell
 */
public class DosenTabel extends AbstractTableModel {

    private String columns[] = {"nip", "alamat", "dosen"};
    private ArrayList<Dosen> data;

    public DosenTabel(ArrayList<Dosen> data) {
        this.data = data;
    }

    @Override
    public int getRowCount() {
        return getData().size();
    }

    public String[] getColumns() {
        return columns;
    }

    @Override
    public int getColumnCount() {
        return getColumns().length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Dosen dos = getData().get(rowIndex);
        if (columnIndex == 0) {
            return dos.getNIP();
        } else if (columnIndex == 1) {
            return dos.getAlamat();
        } else {
            return dos.getNama();
        }
    }

    public void setColumns(String[] columns) {
        this.columns = columns;
    }

    public ArrayList<Dosen> getData() {
        return data;
    }

    public void setData(ArrayList<Dosen> data) {
        this.data = data;
    }
}
